-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: data-disabled CSS selector for DateField #7896
base: main
Are you sure you want to change the base?
Fix: data-disabled CSS selector for DateField #7896
Conversation
…://github.com/suyash5053/react-spectrum into 7890-fix-data-disabled-selector-for-DateField
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, would you be willing to add some tests such as https://github.com/adobe/react-spectrum/blob/main/packages/react-aria-components/test/DateField.test.js#L166 ?
@snowystinger Yeah Sure, I was waiting to see whether I'm on the right track or not. Will write the test cases :). |
Hey @snowystinger, I have added some test cases, feel free to suggest me some more if needed. A different question is, in TimeField we also see the disabled state but there are no test cases related to them. Is this an issue or we just left them knowingly? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tests, I left some comments
defaultValue={new CalendarDate(2020, 2, 3)} | ||
validationBehavior="aria" | ||
isDisabled> | ||
{({isInvalid, isDisabled}) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this one added? I see no assertion against it
@@ -286,6 +293,81 @@ describe('DateField', () => { | |||
expect(group).not.toHaveAttribute('data-invalid'); | |||
}); | |||
|
|||
it('should support both invalid and disabled states simultaneously', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does it need to support them simultaneously? a disabled control can't be invalid, it's essentially invisible to everyone
expect(group).toHaveClass('disabled'); | ||
}); | ||
|
||
it('should use controlled disabled state', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is unneeded, it's not testing anything different than what the first test should be checking
expect(group).toHaveClass('disabled'); | ||
}); | ||
|
||
it('should not validate on submit when disabled', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe anything in this PR altered this behaviour, did you run into some issues with this? or what inspired this test?
Closes #7890
✅ Pull Request Checklist: